﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Taobao.Tools2.Domain.EntityFramework.Mappings;

namespace Taobao.Tools2.Domain.EntityFramework
{
    public class TradeMapping:ModelMapping<Trade>
    {
        public TradeMapping()
            : base()
        {
            Map(d => d.ToTable("Trade"));

            Property(c => c.SellerNick).HasColumnName("Seller_nick");
            Property(c => c.BuyerNick).HasColumnName("Buyer_nick");
            Property(c => c.Created).HasColumnName("Status");
            Property(c => c.OrdersTitle).HasColumnName("OrdersTitle");
            Property(c => c.OrderPrice).HasColumnName("OrderPrice");
            Property(c => c.OrderNum).HasColumnName("OrderNum");
            Property(c => c.PayTime).HasColumnName("PayTime");
            Property(c => c.AlipayNo).HasColumnName("AlipayNo");
            Property(c => c.BuyerMemo).HasColumnName("BuyerMemo");
            Property(c => c.Payment).HasColumnName("Payment");
            Property(c => c.TaobaoTID).HasColumnName("TaobaoTid");
            Property(c => c.ReceiverAddress).HasColumnName("ReceiverAddress");
            Property(c => c.ReceiverCity).HasColumnName("ReceiverCity");
            Property(c => c.ReceiverName).HasColumnName("ReceiverName");
            Property(c => c.ReceiverState).HasColumnName("ReceiverState");
            Property(c => c.ReceiverDistrict).HasColumnName("ReceiverDistrict");
            Property(c => c.ReceiverZip).HasColumnName("ReceiverZip");
            Property(c => c.ReceiverMobile).HasColumnName("ReceiverMobile");
            Property(c => c.ReceiverPhone).HasColumnName("ReceiverPhone");
            Property(c => c.SellerMobile).HasColumnName("SellerMobile");
            Property(c => c.SellerName).HasColumnName("SellerName");
            Property(c => c.Created).HasColumnName("Created");
            Property(c => c.BuyerAlipayNo).HasColumnName("BuyerAlipayNo");
            Property(c => c.PostFee).HasColumnName("PostFee");
            Property(c => c.ShippingType).HasColumnName("ShippingType");
            Property(c => c.Type).HasColumnName("Type");
            //Property(c => c.Process).HasColumnName("Process");
            //Property(c => c.ProcessTime).HasColumnName("ProcessTime");

            Property(c => c.SellerMemo).HasColumnName("SellerMemo");
            Property(c => c.SellerFlag).HasColumnName("SellerFlag");
            Property(c => c.EndTime).HasColumnName("endtime");
            Property(c => c.AdjustFee).HasColumnName("Adjust_fee");
            Property(c => c.DiscountFee).HasColumnName("Discount_fee");
            Property(c => c.Seller_Flag).HasColumnName("Seller_Flag");
            Property(c => c.TProcess).HasColumnName("TProcess");
            Property(c => c.ShopID).HasColumnName("Shop");
            
            Property(c => c.ID).HasColumnName("TID"); 
            HasKey(c => c.ID);

            //Property(c => c.InTime).HasColumnName("intime");
            //Property(c => c.DelFlag).HasColumnName("delflag");
            //Property(c => c.CwchkFlag).HasColumnName("cwchkflag");
            //Property(c => c.CwchkTime).HasColumnName("cwchktime");
            //Property(c => c.CwchkUser).HasColumnName("cwchkUser");
            //Property(c => c.NBDailIDD).HasColumnName("nb_dailidd");
            //Property(c => c.MakeSureFlag).HasColumnName("makesureflag");
            //Property(c => c.GetTKFlag).HasColumnName("gettkflag");
            //Property(c => c.TKFlag).HasColumnName("tkflag");
            //Property(c => c.MakeUser).HasColumnName("makeUser");

            HasMany<OrderInfo>(c => c.OrderInfos).WithRequired(o => o.Trade);
            HasMany<PromotionDetail>(c => c.PromotionDetails).WithRequired(o => o.Trade);
        }
    }
}
